package com.hjc.springbootmovies.mapper;

import com.hjc.springbootmovies.entity.ModelEmp;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * Created by IntelliJ IDEA.
 * User: HJC
 * Date: 2019/12/6
 * Time: 8:28
 * To change this template use File | Settings | File Templates.
 */
@Mapper
public interface MappingEmp {
    @Select("SELECT * FROM emp")
    List<ModelEmp> queryEmp();

    @Select("SELECT * FROM emp where eid=#{eid} ")
    ModelEmp queryById(int eid);

    @Insert("INSERT INTO emp(ename,esex,egw) VALUES(#{ename} ,#{esex} ,#{egw} )")
    @Options( useGeneratedKeys = true , keyColumn = "eid")
    int addEmp(ModelEmp modelEmp);

    @Delete("DELETE FROM emp WHERE eid = #{eid} ")
    int deleteById(int eid);

    @Update("UPDATE emp SET ename=#{ename} ,esex = #{esex} ,egw=#{egw} WHERE eid=#{eid}")
    int updateEmp(ModelEmp modelEmp);
}
